<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="项目名称" name="projectName"/>
        <f-search-form-item label="项目代码" name="projectCode"/>
      </f-search-form>
      <f-table ref="table" rowKey="projectId" :columns="columns" :exportBtn="false" :multiple="false"
               :operator="operator"
               :params="queryParam" :api="api.project" handler="projectPageListHandler">
        <span slot="state" slot-scope="text, record, index">
          <div v-if="record.state==0">正常</div>
          <div v-if="record.state==1">锁定</div>
        </span>
        <span slot="action" slot-scope="text, record">
          <template>
             <a @click="$refs.groupDrawer.showDrawer(record)">查看详情</a>
          </template>
        </span>
      </f-table>
      <bmp-group-drawer ref="groupDrawer"></bmp-group-drawer>
    </a-card>
  </div>
</template>
<script>
  import bmpGroupDrawer from './bmp_group_drawer'
  import api from './js/api'

  export default {
    name: 'TableList',
    components: {
      bmpGroupDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // 表头
        columns: [
          {
            title: '项目编码',
            align: 'center',
            dataIndex: 'projectCode'
          },
          {
            title: '项目名称',
            align: 'center',
            dataIndex: 'projectName'
          },
          {
            title: '版本号',
            align: 'center',
            dataIndex: 'bigVersion'
          },
          {
            title: '创建人',
            align: 'center',
            dataIndex: 'userName'
          },
          {
            title: '项目状态',
            align: 'center',
            scopedSlots: { customRender: 'state' },
            dataIndex: 'state'
          },
          {
            title: '创建时间',
            align: 'center',
            dataIndex: 'createTime'
          },
          {
            title: '更新时间',
            align: 'center',
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
      this.queryParam['isReport'] = true
    },
    methods: {}
  }
</script>
